*------------------------------------------------------------------------------*
* Family history - Dinas, Fouka, Schläpfer - JoP
*------------------------------------------------------------------------------*

*------------------------------------------------------------------------------*
* Figure 3
*------------------------------------------------------------------------------*



*------------------------------------------------------------------------------*
* Greece
*------------------------------------------------------------------------------*

use greece, clear

gen above52=(age>=52)
replace above52=. if age==.
gen highschool=(edu>=4)
replace highschool=. if edu==.
gen ab1000=(income>=3)
replace ab1000=. if income==.
gen pension=(occupation==3 | occupation==4)
replace pension=. if occupation==.
gen public=(occupation==1)
replace public=. if occupation==.
gen employer=(occupation==5)
replace employer=. if occupation==.

foreach x in asiaminor above52 highschool female ab1000 pension public employer nd syriza {
	gen t1_`x'=T*`x'
}

local subgroups asiaminor above52 highschool female ab1000 pension public employer nd syriza 
local controls i.age female i.nomos
estimates clear

local cc=0
foreach x in `subgroups' {
	reg pc_all_bst `x' T t1_`x' `controls', cl(municipality)
	eststo m`cc'_a
	reg pc_behst `x' T t1_`x' `controls', cl(municipality)
	eststo m`cc'_b
	local cc=`cc'+1
}


coefplot (m0_b, aseq("Asia Minor") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) label("Quasi-behavioral")) ///
(m0_a, offset(-0.15) aseq("Asia Minor") keep(t1_*) mcolor(red) ciopts(lcolor(red red)) label("Attitudes")) ///
(m1_b, aseq("Age: Above median") mcolor(blue) keep(t1_*) ciopts(lcolor(blue blue)) nokey) ///
(m1_a, aseq("Age: Above median") offset(-0.15)  mcolor(red) keep(t1_*) ciopts(lcolor(red red)) nokey) ///
(m2_b, aseq("Completed high school") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) nokey) ///
(m2_a, aseq("Completed high school") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m3_b, aseq("Female") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) nokey) ///
(m3_a, aseq("Female") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m4_b, aseq("Income: Above median") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) nokey) ///
(m4_a, aseq("Income: Above median") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m5_b, aseq("Retired") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) nokey) ///
(m5_a, aseq("Retired") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m6_b, aseq("Public sector") mcolor(blue) keep(t1_*) ciopts(lcolor(blue blue)) nokey) ///
(m6_a, aseq("Public sector") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m7_b, aseq("Employer") mcolor(blue) keep(t1_*) ciopts(lcolor(blue blue)) nokey) ///
(m7_a, aseq("Employer") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m8_b, aseq("Voted ND") mcolor(blue) keep(t1_*) ciopts(lcolor(blue blue)) nokey) ///
(m8_a, aseq("Voted ND") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m9_b, aseq("Voted Syriza") mcolor(blue) keep(t1_*) ciopts(lcolor(blue blue)) nokey) ///
(m9_a, aseq("Voted Syriza") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey), ci(95 90) xline(0, lcolor(gs10)) ///
ysca(titlegap(2)) msize(small) ///
xtitle("Differential treatment effect", size(small)) ytitle("", size(small)) ///
xlabel(, nogrid labsize(small)) ylabel(, nogrid labsize(small)) xsca(titlegap(2)) ///
grid(none) swapnames legend(size(small) cols(1) width(28)) title("Greece", size(small))

graph save Greece.gph, replace

*------------------------------------------------------------------------------*
* Germany
*------------------------------------------------------------------------------*

use germany, clear


foreach x in ageabovemed highschool income_ok female cdu17 spd17 afd17 fdp17 dielinke17 gruene17 centerleft centerright {
	gen t1_`x'=t1*`x'
}
local subgroups female ageabovemed highschool income_ok cdu17 spd17 afd17 fdp17 dielinke17 gruene17 centerleft centerright  
local controls i.state
estimates clear

reg pc_att expellee t1 inter_exp_t1 `controls', cl(GKZ)
eststo m_exp_a
reg donate_st expellee t1 inter_exp_t1 `controls', cl(GKZ)
eststo m_exp_b

local cc=0
foreach x in `subgroups' {
	reg pc_att `x' t1 t1_`x' `controls', cl(GKZ)
	eststo m`cc'_a
	reg donate_st `x' t1 t1_`x' `controls', cl(GKZ)
	eststo m`cc'_b
	local cc=`cc'+1
}


coefplot (m_exp_b, aseq("Expellee") keep(inter_exp_t1) mcolor(blue) ciopts(lcolor(blue blue)) label("Donation")) ///
(m_exp_a, offset(-0.15) aseq("Expellee") keep(inter_exp_t1) mcolor(red) ciopts(lcolor(red red)) label("Attitudes")) ///
(m0_b, aseq("Female") mcolor(blue) keep(t1_*) ciopts(lcolor(blue blue)) nokey) ///
(m0_a, aseq("Female") offset(-0.15)  mcolor(red) keep(t1_*) ciopts(lcolor(red red)) nokey) ///
(m1_b, aseq("Age: Above median") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) nokey) ///
(m1_a, aseq("Age: Above median") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m2_b, aseq("Completed high school") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) nokey) ///
(m2_a, aseq("Completed high school") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m3_b, aseq("Lives comfortably") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) nokey) ///
(m3_a, aseq("Lives comfortably") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m4_b, aseq("Center left") keep(t1_*) mcolor(blue) ciopts(lcolor(blue blue)) nokey) ///
(m4_a, aseq("Center left") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey) ///
(m5_b, aseq("Center right") mcolor(blue) keep(t1_*) ciopts(lcolor(blue blue)) nokey) ///
(m5_a, aseq("Center right") offset(-0.15)  keep(t1_*) mcolor(red) ciopts(lcolor(red red)) nokey), ci(95 90) xline(0, lcolor(gs10)) ///
ysca(titlegap(2)) msize(small) ///
xtitle("Differential treatment effect", size(small)) ytitle("", size(small)) ///
xlabel(, nogrid labsize(small)) ylabel(, nogrid labsize(small)) xsca(titlegap(2)) ///
grid(none) swapnames legend(size(small) cols(1)) title("Germany", size(small))

graph save Germany.gph, replace

*------------------------------------------------------------------------------*
* Combine
*------------------------------------------------------------------------------*


graph combine Greece.gph Germany.gph, xcommon iscale(1)

